<?php
use App\Utils;

?>
@extends('layouts.master3')
@section('css')
    <link href="/css/people.css" rel="stylesheet">
@stop
@section("title","私信")
@section('content')
    <div class="contain">
        <div class="row">
            <div class="col-md-1"></div>
            <div class="col-md-9">
                <h4>我的私信</h4>
                <hr>
            </div>
            <div class="col-md-2"></div>
        </div>


        @foreach($messages as $message)
            <div class="row">
                <div class="col-md-1"></div>
                <div class="" style="margin-left: 15px;overflow: hidden;float: left;">
                    <a class="pull-left">
                        <img class="img-circle" alt="Cinque Terre" width="40" height="40"
                             src="{{$message->sender->avatar->url('thumb')}}" alt="">
                    </a>

                </div>
                <div class="col-md-8">
                    <div class="post-preview">
                        @if ($message->receiverid == null||$message->senderid==55)
                            <B>{{$message['sender']->name}}:</B></br>
                        @else
                            <B>{{$message['sender']->name}} 回复了 {{$message['receiver']['name']}}:</B><br>
                        @endif

                            @if ($message->sender->id == 55)
                            {!! $message->content !!}
                            @else
                            {{ $message->content }}
                            @endif
                            </br>
                            <font color="gray">
                                <small>{{$message->updated_at}}</small>
                            </font>
                            @if ($message->sender->id != 55)
                                <a class="ql_send_letter pull-right" data-id="{{$message->sender->id}}"
                                   data-name="{{$message->sender->name}}" href="" data-toggle="modal"
                                   data-target="#myModal"
                                   title="给他/她回复" style="border:none;">回复</a>
                            @endif

                    </div>

                    <hr>
                </div>
                <div class="col-md-2"></div>

            </div>
        @endforeach
    </div>
    <!-- 发私信弹窗  -->
    <div class="ql_letter_modal modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                                aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">发送私信</h4>
                </div>
                <div class="modal-body">
                    <dl>
                        <dt class="send_label">
                            <label>发给:</label>
                        </dt>
                        <dd>
                            <div class="send_name"><input type="text" readonly="true" value=""></div>
                        </dd>
                        <dt class="send_label">
                            <label>内容:</label>
                        </dt>
                        <dd class="ml">
                            <div class="send_editor">
                                <textarea class="editor_content" style="font-weight: normal; height: 22px;"></textarea>
                            </div>
                        </dd>
                    </dl>
                </div>
                <div class="modal-footer">
                    <a href="javascript:;" class="close_btn" data-dismiss="modal">取消</a>
                    <button type="button" class="btn btn-primary" id="sendTo">发送</button>
                </div>
            </div>
        </div>
    </div>
    <!--私信发送结果-->
    <div class="alert alert-warning alert-dismissible none" role="alert"
         style="position: fixed;top: 50%;left: 50%;width: 400px;text-align: center;margin-left: -200px;margin-top: -26px;">
        <button type="button" data-id="" class="close" data-dismiss="alert" aria-label="Close"><span
                    aria-hidden="true">&times;</span></button>
        <strong>发送成功!</strong>
    </div>
@stop
@section('js')
    <script src="/js/inbox.js"></script>
@stop
